package com.zhu.mpg.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zhu.mpg.common.PageVo;
import com.zhu.mpg.entity.Employee;
import com.zhu.mpg.mapper.EmployeeMapper;
import com.zhu.mpg.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author caoyunqi
 * @since 2021-03-17
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements EmployeeService {
    @Autowired
    EmployeeMapper employeeMapper;

    public PageVo<Employee> findEmpPage(Map<String,String> map) {

        Integer pageNum=  Integer.valueOf(map.get("pageNum")+"");  //当前页
        Integer pageSize=  Integer.valueOf(map.get("pageSize")+""); //每页显示的数目
        Page<Employee> pag=new Page<Employee>(pageNum,pageSize);
        List<Employee> empPage = employeeMapper.findEmpPage(pag);
        PageVo<Employee> pageEmp=new PageVo<Employee>();
        pageEmp.setTotal(pag.getTotal());
        pageEmp.setRows(empPage);
        return pageEmp;
    }

    @Override
    public int xiugai(Employee employee) {
        int xg=employeeMapper.xiugai(employee);
        return xg;
    }

    @Override
    public int shanchu(int bh) {
        int ss=employeeMapper.shanchu(bh);
        return ss;
    }

}
